package com.lujianfei.redpacketstat.database.dao

import androidx.room.*
import com.lujianfei.redpacketstat.database.bean.RedPacketEntity
import com.lujianfei.redpacketstat.database.bean.UserEntity


@Dao
interface RedPacketDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(vararg entity: RedPacketEntity): LongArray

    @Update(onConflict = OnConflictStrategy.REPLACE)
    fun update(vararg entity: RedPacketEntity)

    @Delete
    fun delete(vararg entity: RedPacketEntity)

    @Query("SELECT * FROM redpacket where userId = :userId")
    fun queryByUserId(userId: Int): RedPacketEntity?

    @Query("SELECT * FROM redpacket")
    fun queryAll(): MutableList<RedPacketEntity>
}